|
|
|
|
|
|
|
Tip You can use the CodeModule object to add, modify, or delete code associated with a particular class or form. For more information, see your Books Online in Visual Basic. |
|
|
|
|
|
|
|
|
|
Notice that you could have combined the If Then code for both ListBox and ComboxBox objects as follows: |
|
|
|
|
|
|
|
|
If TypeOf argObject Is ListBox or TypeOf argObject _
Is ComboBox Then
argObject.AddItem argObject.List(argObject.ListIndex)_ argString
End If
If TypeOf argObject Is ListBox Or TypeOf argObject _
Is ComboBox Then
argObject.RemoveItem argObject.ListIndex
End If |
|
|
|
|
|
|
|
|
Feel free to choose either option. |
|
|
|
|
|
|
|
|
Describing the Classes in the Subsystem |
|
|
|
|
|
|
|
|
The kinds of forms and objects that participate in a Graphical User Interface Subsystem can vary widely. In the preceding section, you were introduced to the IInfoMaintenance and InfoMaintenance classes. You could also have a class that handles common behavior for buttons that close a form, that perform cancellations or undo operations, and so on. A good name for such a class might be FormOperations. |
|
|
|
|
|
|
|
|
The FormOperations class might have the following methods: |
|
|
|
|
|
|
|
|
Public Sub clickedOKBtn()
Public Sub clickedCancelBtn()
Public Sub clickedUndoBtn()
Public Sub clickedDoneBtn()
Public Sub clickedSaveBtn() |
|
|
|
|
|
|
|
|
Assume the FormOperations class has an instance named theFormOperations. Also assume you have a form, frmForm, with a command button, cmdDone. The frmForm form might invoke clickedDoneBtn, as follows: |
|
|
|
|
|
|
|
|
Public Sub cmdDone_Click()
theFormOperations.clickedDoneBtn Me
End Sub |
|
|
|
|
|